// -*-c#-*-
// License: New BSD License : http://www.opensource.org/licenses/bsd-license.php
//
// Copyright (c) 2008, Brothers In Arms/Burl Nyswonger
//
// See: BiaVote.uc for full License
// 
//@L

class BiaVoteMutator extends Mutator;

`include( BiaVote/Classes/BiaStdInc.uci ) 
`include( BiaVote/Classes/BiaVote.uci )

function Mutate(string MutateString, PlayerController Sender)
{
    `BiaDbg("Mutate '"$ MutateString $"' - from: " $ Sender );
    MutateString = Locs(MutateString);
    if( MutateString == "vote" || MutateString == "biavote" )
    {
        class'BiaVote.BiaVote'.static.ExecPlayerOpenUI( Sender );
    }
    Super.Mutate(MutateString, Sender);
}

function InitMutator(string Options, out string ErrorMessage)
{
    `BiaDbg("InitMutator()...");

    `if(`isdefined(DEBUG))
        class'BiaVote.BiaVote'.static.ReportWorldObjects(WorldInfo);
    `endif
        
    if( class'BiaVote.BiaVote'.static.SpawnInstance( WorldInfo.Game ) )
    {
        UTGame(WorldInfo.Game).bAllowMapVoting = false;
        UTGame(WorldInfo.Game).VoteDuration = 10;
        `BiaDbg("It worked...");
    }
    else
    {
        `BiaDbg("It didn't work!!!");
    }
    
    Super.InitMutator(Options, ErrorMessage);
}

function NotifyLogout(Controller Exiting)
{
    class'BiaVote.BiaVote'.static.NotifyLogout( Exiting );
    Super.NotifyLogout( Exiting );
}

function NotifyLogin(Controller NewPlayer)
{
    Super.NotifyLogin( NewPlayer );
    class'BiaVote.BiaVote'.static.NotifyLogin( NewPlayer );
}

defaultproperties
{

}